<template>
  <div class="projects">
    <div class="container">
      <h1 class="section-title">{{ $t('projects.title') }}</h1>
      
      <div class="projects-grid">
        <div v-for="project in projects" 
             :key="project.id"
             class="project-card card hover-lift"
        >
          <div class="project-image">
            <img v-lazy="project.image" :alt="project.title">
          </div>
          <div class="project-content">
            <h3>{{ project.title }}</h3>
            <p class="project-description">{{ project.description }}</p>
            <div class="project-tech">
              <span v-for="tech in project.technologies" 
                    :key="tech"
                    class="tech-tag"
              >
                {{ tech }}
              </span>
            </div>
            <div class="project-links">
              <a :href="project.demo" 
                 target="_blank" 
                 rel="noopener noreferrer" 
                 class="btn btn-sm"
              >
                <i class="fas fa-external-link-alt"></i> Demo
              </a>
              <a :href="project.github" 
                 target="_blank" 
                 rel="noopener noreferrer" 
                 class="btn btn-sm btn-outline"
              >
                <i class="fab fa-github"></i> GitHub
              </a>
            </div>
          </div>
        </div>
      </div>
    </div>
    <BackToTop />
  </div>
</template>

<script>
import BackToTop from '@/components/BackToTop.vue'

export default {
  name: 'Projects',
  
  components: {
    BackToTop
  },
  
  data() {
    return {
      projects: [
        {
          id: 1,
          title: '个人博客系统',
          description: '使用 SpringBoot 和 HTML 开发的全栈博客系统，支持 Markdown 编辑、评论系统等功能。',
          image: '/projects/blog.png',
          technologies: ['Java', 'HTML', 'Mysql', 'javaScript'],
          demo: 'https://blog.jun-mou.top',
          github: 'https://gitee.com/wyq517/sansui-blog'
        },
        {
          id: 2,
          title: '天气预报小程序',
          description: '基于 Vue.js 的电商平台前端项目，包含商品展示、购物车、订单管理等功能。',
          image: '/projects/weather.png',
          technologies: ['Vue.js', 'Vuex', 'Element UI', 'Axios'],
          demo: 'https://gitee.com/wyq517/sansui-weather-applet',
          github: 'https://gitee.com/wyq517/sansui-weather-applet'
        },
        {
          id: 3,
          title: '圣诞礼物-圣诞树',
          description: '团队协作任务管理工具，支持任务分配、进度跟踪、数据统计等功能。',
          image: '/projects/tree.png',
          technologies: ['Vue.js', 'TypeScript', 'Firebase', 'Tailwind CSS'],
          demo: 'https://www.jun-mou.top/love/tree/',
          github: 'https://gitee.com/wyq517/sansui-christmas-tree'
        }
      ]
    }
  }
}
</script>

<style lang="scss" scoped>
.projects {
  padding: 2rem 0 4rem;
  
  .projects-grid {
    max-width: 1200px;
    margin: 0 auto;
  }
}

.section-title {
  text-align: center;
  margin-bottom: 3rem;
  color: var(--accent-color);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.project-card {
  overflow: hidden;
  transition: transform var(--transition-speed);
  
  &:hover {
    transform: translateY(-5px);
  }
}

.project-image {
  width: 100%;
  height: 200px;
  overflow: hidden;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
  
  img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-speed);
    
    &:hover {
      transform: scale(1.05);
    }
  }
}

.project-content {
  padding: 1.5rem;
  
  h3 {
    margin-bottom: 1rem;
    color: var(--accent-color);
  }
}

.project-description {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.6;
}

.project-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.tech-tag {
  padding: 0.25rem 0.75rem;
  background-color: var(--bg-secondary);
  border-radius: 20px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.project-links {
  display: flex;
  gap: 1rem;
  
  .btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    
    i {
      margin-right: 0.5rem;
    }
  }
}

@media (max-width: 768px) {
  .projects-grid {
    grid-template-columns: 1fr;
    padding: 0 1rem;
  }
}
</style> 